const http = require('http');

let server=http.createServer((req,res)=>{
    let allowHosts=['baidu.com','tianmao.com'];
    if(allowHosts.indexOf(req.headers['origin'])!=-1){
        res.setHeader('Access-Control-Allow-Origin', '*');
    }
    res.write('123456')
    res.end()
})
server.listen(8080)